package com.kexinde.wjifen.dao;

import java.util.List;

import com.kexinde.wjifen.util.JdbcTemplate;
import com.kexinde.wjifen.vo.ShopCommentView;

public class ShopCommentViewDao {

	/**
	 * 根据shopId获取最新的8条评论
	 * 
	 * @param shopId
	 * @return
	 * @throws Exception
	 */
	public List<ShopCommentView> findByShopId(Long shopId) throws Exception {
		String sql = "select id,time,shopId,userId,content,tasteRank,environmentRank,serviceRank,name,imagePath from v_shopcomment where shopId=? "
				+ "order by time desc limit ?,?;";
		Object[] params = { shopId, 0, 8 };
		return JdbcTemplate.queryList("com.kexinde.wjifen.vo.ShopCommentView", sql, params, 10);
	}
}
